1 00:00:00,660 --> 00:00:09,390 Hello we are going to continue from where we left off in part one where we were creating the functionality 2 00:00:09,410 --> 00:00:11,620 using javascript. 3 00:00:12,750 --> 00:00:17,640 I have added some more could here line 10. 4 00:00:17,640 --> 00:00:23,140 Here's something I've introduced is called It Gets fuel don't focus this method or function. 5 00:00:23,200 --> 00:00:30,610 What does it forces the cursor on the input bot button input box. 6 00:00:30,620 --> 00:00:33,000 Where you make your guesses. 7 00:00:33,010 --> 00:00:37,430 Case so this is a function from the previous lecture. 8 00:00:37,670 --> 00:00:38,770 In this lecture. 9 00:00:38,880 --> 00:00:43,910 I have just introduced a new function. 10 00:00:45,090 --> 00:00:48,660 I have 144 here like 44. 11 00:00:48,840 --> 00:00:57,690 I have attached an ADD event listner to the guess sub meet variable. 12 00:00:57,780 --> 00:01:01,270 What did guess that guess submit. 13 00:01:01,310 --> 00:01:03,950 Get -- we've got the guess submit 14 00:01:06,710 --> 00:01:07,080 we've got. 15 00:01:07,080 --> 00:01:10,820 Guess suddenly variable defined on line 5. 16 00:01:11,010 --> 00:01:12,990 So what I'm doing here 17 00:01:15,340 --> 00:01:17,490 line 44. 18 00:01:17,700 --> 00:01:26,280 I have attached an event list now so what it will do it all list in out the event list 9 takes in two 19 00:01:26,280 --> 00:01:27,510 parameters. 20 00:01:27,510 --> 00:01:30,360 The first is the event which is the click. 21 00:01:30,360 --> 00:01:33,880 The second is the check guess. 22 00:01:37,420 --> 00:01:41,940 We've got a function coord check guest. 23 00:01:42,070 --> 00:01:48,110 If I screw up we've got a function called check against on line 12. 24 00:01:48,130 --> 00:01:54,240 We quit the financial code check guests so that's what is referring to here. 25 00:01:54,310 --> 00:01:55,570 Just check guess. 26 00:01:55,600 --> 00:02:01,590 So we take seem to this event list now takes in to perimeter's or arguments. 27 00:02:01,630 --> 00:02:05,600 First is the event which is a click secon is a function call check. 28 00:02:05,650 --> 00:02:15,130 Guess the function we already created will got a function here on line 46 that ends the line 53. 29 00:02:15,130 --> 00:02:17,470 The function is called set. 30 00:02:17,470 --> 00:02:18,910 Game over. 31 00:02:19,090 --> 00:02:25,150 Basically this function is used to set the game when the game is over. 32 00:02:25,180 --> 00:02:31,120 So in between this curly braces is what the function actually will do. 33 00:02:31,810 --> 00:02:36,740 Note is that the guess field is set to disable and it gets solved. 34 00:02:36,750 --> 00:02:39,610 It is set to disabled and the value is true. 35 00:02:39,820 --> 00:02:43,230 What that means is that once the game is over you won't be. 36 00:02:43,230 --> 00:02:47,680 It doesn't let you inputs anything that does let you submit. 37 00:02:47,780 --> 00:02:48,600 Thus what line. 38 00:02:48,590 --> 00:02:56,710 Forty seven point forty it means line 49 is the actual reset button so it will then create a button 39 00:02:57,160 --> 00:03:07,110 which will have the text which you have the test detects to reset on it so you should have ditto's start 40 00:03:07,240 --> 00:03:08,020 new game. 41 00:03:08,030 --> 00:03:08,450 Sorry 42 00:03:11,200 --> 00:03:13,230 let me go through that again. 43 00:03:13,390 --> 00:03:18,150 Line 46 Chris page function cause set to Game Over. 44 00:03:18,150 --> 00:03:24,210 This function is called When the game is over when all the attempts have been used. 45 00:03:24,460 --> 00:03:34,250 An what like 40 740 a unfortified does it disable the ability for the player to enter. 46 00:03:34,250 --> 00:03:38,730 Any more guesses are no sort to of meet anymore guesses. 47 00:03:38,740 --> 00:03:41,090 That's why the value set to true. 48 00:03:41,230 --> 00:03:42,460 Once the game is over. 49 00:03:42,460 --> 00:03:49,680 You should not be able to input anything until the game is restarted. 50 00:03:50,470 --> 00:04:01,470 Line 49 that a variable called reset button that variable is been set with a new value. 51 00:04:01,510 --> 00:04:07,240 Would be opposed to a document but create element to it that is used to create a button. 52 00:04:07,560 --> 00:04:14,340 Alright so once the game is over this button is treated and like 50 tells you to text. 53 00:04:14,350 --> 00:04:23,170 Now beyond the button the text should say start new game this button only appears once The game is over 54 00:04:23,920 --> 00:04:28,530 and then here on Life 2 on the third document the body or tappin child. 55 00:04:28,530 --> 00:04:35,860 What that means is and once the game is over it will attach the button to the body of the document of 56 00:04:35,860 --> 00:04:37,270 the email document as well. 57 00:04:37,270 --> 00:04:38,400 The append means. 58 00:04:38,590 --> 00:04:43,780 And then read this reset button or attached. 59 00:04:45,880 --> 00:04:51,890 Saw on line 50 to the have title and event list now to the reset button. 60 00:04:51,890 --> 00:04:59,410 This button was just been created and it takes in two values or arguments it click the click events 61 00:04:59,410 --> 00:05:02,240 or when you click on it it respond. 62 00:05:02,260 --> 00:05:08,690 And he also reset the game because this function reset the game. 63 00:05:10,380 --> 00:05:14,600 This really sick game function is a function we've defined below here. 64 00:05:15,000 --> 00:05:22,680 So this will be triggered once you reset the game using this set game over function. 65 00:05:22,740 --> 00:05:30,020 So life 55 is a new function called Reset game and it's all online. 66 00:05:30,030 --> 00:05:38,430 Fifty six it takes the first count to be one that is the first attempt and then Fifty eight is it a 67 00:05:38,430 --> 00:05:40,640 variable called resaid Paris. 68 00:05:40,830 --> 00:05:50,900 And you said that variable took equals to this query select or this group select or means it will count 69 00:05:50,990 --> 00:05:55,370 or the paragraph that belongs to this class called result. 70 00:05:55,430 --> 00:06:01,400 Paris like 59 says that for this is a for loop the loop. 71 00:06:01,580 --> 00:06:09,480 So it is got a variable of hi which is kind of like the counter it started at an initial value of zero 72 00:06:10,140 --> 00:06:12,060 and then the counter starts. 73 00:06:12,070 --> 00:06:19,710 If the value of which is set to zero is less than the resaid power as does let the lenthall of it is 74 00:06:19,910 --> 00:06:27,540 done that then the high value of a will increase blows plus means increase it will increase mound 1 75 00:06:28,320 --> 00:06:30,680 and then like this to reset paragraph. 76 00:06:30,690 --> 00:06:40,620 Here now the value of the eye which acts as a counter will be inserted inside this array. 77 00:06:40,620 --> 00:06:41,770 This is an I read. 78 00:06:42,060 --> 00:06:44,720 So it would be to insert caddies each of the numbers. 79 00:06:44,730 --> 00:06:53,880 Each time the user has a goal that count is recorded inside this very okay and displayed here which 80 00:06:53,910 --> 00:06:55,050 this is a blank. 81 00:06:55,390 --> 00:06:56,990 It's a column. 82 00:06:57,140 --> 00:06:58,160 It's just a space. 83 00:06:58,180 --> 00:07:06,450 This creates a space where the numbers the temps will be record it line sixty three used a reset button. 84 00:07:06,510 --> 00:07:12,360 So what happens is that once the game has been reset it. 85 00:07:12,420 --> 00:07:16,190 This will remove the button from the page. 86 00:07:16,350 --> 00:07:17,500 The button don't disappear. 87 00:07:17,500 --> 00:07:24,600 This button only appears when you release when the game is finished and gives you an option to reset 88 00:07:24,600 --> 00:07:26,760 the game once the game is in motion. 89 00:07:26,760 --> 00:07:35,730 You do not see this button on line 63 so everything in here between the curly braces here and the one 90 00:07:35,730 --> 00:07:40,530 on 74 is what will happen when the game is reset when the game is reset. 91 00:07:40,530 --> 00:07:49,200 The ghosts feel is den reactivated it becomes forced families is now enabled you can put something in 92 00:07:49,200 --> 00:07:49,820 it. 93 00:07:50,040 --> 00:07:57,610 These submit button also DNA built is change the values change to force when the game is reset and when 94 00:07:57,610 --> 00:08:00,320 the game is over and these values are true. 95 00:08:02,220 --> 00:08:04,920 Line 6 to 7 gets fewer. 96 00:08:04,940 --> 00:08:10,280 Don't value me as whatever value you guess the numbers are displayed here. 97 00:08:10,380 --> 00:08:13,070 Then the sixty eight gets fewer dumped for cause. 98 00:08:13,070 --> 00:08:16,880 These bizarre Achille's used to force on the input. 99 00:08:16,920 --> 00:08:21,820 So now you see as you can focus on what you are typing in on the guesses you're making. 100 00:08:21,820 --> 00:08:31,080 That's what this method is or function like 70 years after the last term this it will display a background 101 00:08:31,080 --> 00:08:37,980 call or use in the style method of property anough set the cochère to this hex value which will be the 102 00:08:37,980 --> 00:08:43,240 same as the caller or the background container of the game. 103 00:08:43,350 --> 00:08:50,220 The same thing with this with the guesses but set to the same and then on line 7 the 3 it calls the 104 00:08:50,220 --> 00:08:58,140 function random number calls is variable random number and it displays the Matt stook floor and then 105 00:08:58,140 --> 00:09:00,470 inside ticcing the random number. 106 00:09:00,480 --> 00:09:04,330 This is a guess so we basically restart the game again. 107 00:09:04,350 --> 00:09:09,520 Once one C gets here causes and the process restarts again. 108 00:09:09,750 --> 00:09:13,300 So that's basically it. 109 00:09:16,400 --> 00:09:21,420 If any part is sounding confusing please let me know. 110 00:09:21,420 --> 00:09:25,830 Are be modern happy to to explain or act. 111 00:09:25,910 --> 00:09:28,130 Thanks for watching. 112 00:09:28,130 --> 00:09:29,550 Bye for now.